<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>账户充值管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../resources/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../resources/css/style.css" media="all">
    <style>
        .laytable-cell-1-log_content{text-align: left !important;}
        table thead tr th div,.layui-table-body .layui-table tbody tr .log_content,table tbody tr td div{text-align: left !important;}
        table tbody tr td .laytable-cell-numbers{text-align: center !important;}
        .masksx .forms{padding-left: 0;text-align: center;}
        .masksx{width: 650px;}
        .mask input{width: 100%!important;}
        .mask .layui-select-title{width: 480px;}
        .masksx{
            height:300px;
        }
        .mask .sug{
            width: 300px !important;
            display: inline;
        }
        .inline-lists{width: 80%;}
        .layui-form-pane .layui-form-label{width: 35%;}
        .mask .layui-input-block{width: 50%;margin-left: 35%;}
        .tijiao{width: 120px;}
    </style>
</head>
<body>
<form class="layui-form layui-form-pane" id="form_7grid" action="" >
    <div class="formTop">
        <div class="layui-input-inline layui-col-lg2 layui-col-md2 layui-col-xs2">
            <div class="layui-input-inline" style="width:80%;">
                <input type="text" class="layui-input" name="zhifubao" placeholder="请输入支付宝单号">
            </div>
        </div>
        <div class="layui-input-inline layui-col-lg2 layui-col-md2 layui-col-xs2">
            <div class="layui-input-inline" style="width:80%;">
                <input type="text" class="layui-input" name="shanghu" placeholder="请输入商户单号">
            </div>
        </div>
        <div class="layui-input-inline layui-col-lg2 layui-col-md2 layui-col-xs2">
            <div class="layui-input-inline" style="width:80%;">
                <input type="text" class="layui-input" name="qiye" placeholder="请输入企业名">
            </div>
        </div>
        <div class="layui-inline layui-col-lg2 layui-col-md2 layui-col-xs2">
            <div class="layui-input-inline"  style="width:80%;">
                <input type="text" class="layui-input" id="test-limit3" placeholder="请选择操作开始日期">
                <div class="icons">

                </div>
            </div>
        </div>
        <div class="layui-inline layui-col-lg2 layui-col-md2 layui-col-xs2">
            <div class="layui-input-inline"  style="width:80%;">
                <input type="text" class="layui-input" id="test-limit4" placeholder="请选择操作结束日期">
                <div class="icons">

                </div>
            </div>
        </div>
        <div class="_sum layui-col-lg2 layui-col-md2 layui-col-xs2">
            <button class="layui-btn tijiao" type="button" onclick="logQueryajaxs()">查询</button>

        </div>
    </div>
    <table id="demo" lay-filter="test"></table>

    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-danger layui-btn-sm luru" lay-event="edit">录入支付单号</a>
        <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="CKXQ" style="background-color: #009688;">查看详情</a>

    </script>
    <div class="mask">
        <div class="masksx">
            <div class="title"><span class="titleL">录入单号</span><span class="close">×</span></div>
            <div class="forms">
                <form class="layui-form addUser" method="post" action="">


                    <div class="layui-inline inline-lists">
                        <div class="layui-form-item">
                            <label class="layui-form-label">请输入线下支付单号<span class="maohao">：</span></label>
                            <div class="layui-input-block">
                                <input type="number" name="mat_freight" lay-verify="required" autocomplete="off" placeholder="请输入线下支付单号" class="layui-input" value="">
                            </div>
                        </div>

                    </div>


                    <div class="_submit">
                        <button class="layui-btn layui-btn-sm tijiao" lay-submit lay-filter="_subm">提交</button>
                        <!--<button class="layui-btn layui-btn-sm " type="reset">重置</button>-->
                    </div>

                </form>

            </div>
        </div>

    </div>



</form>
<a class="dayin" type="button" id="dlink"  style="float: right; position: fixed; right: 50px; bottom: 50px; z-index: 999;"></a>


<script src="../../resources/layui/layui.js" charset="utf-8"></script>
<script src="../../resources/js/style.js"></script>
<script src="../../resources/js/api.js"></script>

<script>
    window.onload=function () {
        if(getCookie('yanzheng')!='admin'){
            location.href='./adminson/admins.html';
        }

    }
    function logQueryajaxs() {
        var zhifubao=$('[name="zhifubao"]').val();
        var shanghu=$('[name="shanghu"]').val();
        var qiye=$('[name="qiye"]').val();
        var begintime=$('#test-limit3').val();
        var endtime=$('#test-limit4').val();


        if(!AntiSqlValid(zhifubao)){
            API.admins({'type':'a','tradeNo':zhifubao,'outTradeNo':shanghu,'cname':qiye,'bengintime':begintime,'endtime':endtime,'p':getCookie('yanzheng')})
            }else {
                layer.msg('请勿输入特殊符号或敏感文字');
            };


    }

    layui.use(['form', 'layedit', 'laydate','table','element'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,table=layui.table
            ,element=layui.element;

            API.admins({'type':'a','p': getCookie('yanzheng')});      //调用页面数据查询 渲染
        //前后若干天可选，这里设置不能选过去的日期      最远可选1000天之后
        panduanshijiantow('#test-limit3','#test-limit4',1000,1000,'.tijiao');     //查询 开始结束时间判断
        dayintishi('.dayin');

        //监听工具条
        table.on('tool(test)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值
            var tr = obj.tr; //获得当前行 tr 的DOM对象

            if(layEvent === 'edit'){ //查看
                //do somehing
                console.log(obj);
                $('[name="mat_freight"]').val('');
                $('.mask').show();
                sessionStorage.id=obj.data.id;
            }else{
                console.log(obj);
                sessionStorage.objs=JSON.stringify(obj);
                location.href='./adminsXQ.html';
            };
        });
        $('.close').click(function () {
            $('.mask').hide();          //关闭遮罩层
            $('.masktow').hide();          //关闭遮罩层

        });

        //添加监听   检查企业名称是否存在
        var time = 0;
        var chushi;
        $("[name='mat_freight']").focus(function(){
            $("[name='mat_freight']").keyup(function () {
                clearTimeout(time);
                console.log(chushi);
                var root = this;
                // 小华更改,128 编辑企业--提交按钮被禁用
                time = setTimeout(function () {
                    var _names=$(root).val();               //获取页面值
                    _names=$.trim(_names);
                    console.log(_names==chushi,'>>>>>>>>>>>>>>>>>>>')
                    if(_names){
                        if(_names==chushi){
                            return;
                        };
                        ajaxs('/api/public/cheName.do','get',{"type":5,"name":_names},function (data) {
                            console.log(data);
                            if(data.data=='0'){
//                            layer.msg('企业名可用');
                                $('.tijiao').removeAttr('disabled').removeClass('layui-btn-disabled');
                            }else{
                                layer.msg('单号已存在 请重新输入');
                                $('.tijiao').attr('disabled',"true").addClass('layui-btn-disabled');
                            };
                        });
                    };
                }, 500);

            });
        });
        //表单提交时触发以下事件  此事件阻止了form表单的提交  使用自定义的ajax进行数据交互
        form.on('submit(_subm)', function(data){
            Btnon('.tijiao');                           //禁止按钮点击功能
            data.field.p=getCookie('yanzheng');
            data.field.compcode1=$('select[name=compname1]').children().filter(':checked').attr('cursom-value');

            layer.confirm('您确认提交吗？', {          //弹出层  弹出提示信息
                btn: ['确认','取消'] //按钮
            }, function(){          //点击确定时对以下代码进行执行
                ajaxs('/api/pay/xxPay.do','post',{'id':sessionStorage.id,'dh':$('[name="mat_freight"]').val()},function (data) {
                    console.log(data)
                    layer.msg(data.msg);
                    if(data.code==0){
                        setTimeout(function () {        //定时器    1秒后刷新页面
                            location.reload()
                        },1000)

                    }else{
                        Btnoff('.tijiao');
                    };
                });

            }, function(){          //点击取消  解禁提交按钮功能
                Btnoff('.tijiao');
            });


            return false;                     //开启禁止页面跳转
        });

    })

</script>
</body>
</html>